package JDBC;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class JDBCDemo10 {
    public static void main(String[] args) throws SQLException {
        Connection conn = DBUtil.getConnection();
        String sql = "UPDATE userinfo "+
                     "SET age=?,nickname=?";
        PreparedStatement ps = conn.prepareStatement(sql);
        ps.setString(1,"20");
        ps.setString(2,"斌斌");
        int sum = ps.executeUpdate();
        if (sum>0){
            System.out.println("成功修改了"+sum+"条记录");
        }
    }
}
